Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

312
Views
¿Enlace de evento angular para el icono de cruz de entrada (tipo = "buscar")?

¿Cómo vincular un evento con Angular 2 (4, 5, 6, 7) para el icono de cruz de un <input type="search"> ? ¿Qué evento se activa?

Buscando una solución como (que no sea (buscar) porque no funciona en IE):

 <input type="search" (click)="search()">

Pregunta adicional: ¿Cuál es el nombre oficial de este icono de cruz? ¿Es un poco difícil buscar en Google/duckduckgoing para una solución cuando no conoce los términos correctos?

Pregunta duplicada: ¿Cómo detecta la limpieza de una entrada HTML5 de "búsqueda"?

about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

 <input type="search" (search)="search()">
about 4 years ago · Santiago Trujillo Report

0

Hay varias formas de vincular el evento de búsqueda con el componente

1) Usar evento de cambio

 <input type="search" class="form-control" placeholder="Search" (change)="onSearchCustomer($event)"> // This event get fired when you type something and hit enter, but if you // again hit enter without adding a new input it won't get fired. //(ie It fires only when the content changes and mean while enter is pressed)

2) Usando el evento de búsqueda

 <input type="search" class="form-control" placeholder="Search" (search)="onSearchCustomer($event)"> // This event is fired whenever enter is pressed.(ie without caring about the change of content)

3) Usando el evento keyup

 <input type="search" class="form-control" placeholder="Search" (keyup)="onSearchCustomer($event)"> // This event is fired on every key press

4) Usando el evento keyup.enter

 <input type="search" class="form-control" placeholder="Search" (keyup.enter)="onSearchCustomer($event)"> // This event is similar to search event which only fires when enter is pressed

Ahora en su archivo de componentes

 onSearchCustomer(event: any) { console.log(event.target.value); }

¡Espero que esto te ayude a ti o a alguien más!

about 4 years ago · Santiago Trujillo Report

0

<input type="search" placeholder="Search for text" #searchInput (keyup)="search(searchInput.value)" (search)="search()">
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!